<div class='grid_18 alpha head'>
  <div class="title">
    <h6>
    <%= raw title_of_orders %>
    </h6>
  </div>
</div>
<div id="orders" class='grid_18 alpha'>
  <div class='grid_17 page'>
    <div class='grid_10 alpha'>
      共<b><%= orders.size %></b>张  
    </div>
    <div class='grid_7 omega filter'>
      <%= render :partial => 'filter_in_index.html' %>
    </div>
  </div>
  <div id="diy_datepicker"></div>
  <div class='grid_17 orders'>
    <% orders.each do |order| %>
      <div class='grid_17 alpha order' >
        <div class="grid_17 alpha omega title">
          <div class='grid_10 alpha about_buyer'>
            <div class='grid_10 push_1'>
              <span class="name"><%= order.buyer_full_name %></span>
              <span class="mobile">
                <%= order.buyer_phone %>
              </span>
            </div>
            <div class="grid_10  push_1 address">
              <%= order.buyer_address %>
            </div>
          </div>
          <div class='grid_7 omega about_order'>
            <div class="status <%= order.status %>">
              <%= t order.status %>
              <% if order.being_edited_by_other_user? %>
              <div class="locked">
                <%= image_tag 'orders/lock.png', :title => "【#{order.being_edited_by_user.full_name}】最近编辑于#{time_ago_in_words order.updated_at, false}前", :alt => "【#{order.being_edited_by_user.full_name}】最近编辑于#{time_ago_in_words order.updated_at, false}前" %>
              </div>
              <% end %>
            </div>
            <div class="order_no">
              <%= link_to order.order_no, order, :title => '浏览该订单', :target => :_blank %>
              <% if order.order_items.any? %>
              <span title='完成度:<%= order.completed_percent %>%,其中【<%= order.order_items.completed.size%>】项结束，【<%= order.order_items.uncompleted.size%>】项进行中' class='percent <%= order.order_items_completed? ? 'completed' : '' %>'><%= order.completed_percent %>%</span>
              <% end %>
            </div>
          </div>
        </div>
        <div class="grid_17 alpha omega fields">
          <dl class='grid_17 alpha'>
            <dt class='grid_3 alpha'>预订日期:</dt>
            <dd class='grid_5'><%= order.ordered_on %></dd>
            <dt class='grid_3 alpha'>交货日期:</dt>
            <dd class='grid_5'><%=  order.deliveried_on %></dd>
          </dl>        
          <dl class='grid_17 alpha'>            
            <dt class='grid_3 alpha'>销售店面:</dt>
            <dd class='grid_5'><%= order.shop_name %></dd>
            <dt class='grid_3 alpha'>销&nbsp;&nbsp;售&nbsp;&nbsp;员:</dt>
            <dd class='grid_5 '><%= order.saler_full_name %></dd>
          </dl>
          <hr/>
          <dl class='grid_17 alpha'>
            <dt class='grid_3 alpha'>成交总价:</dt>
            <dd class='grid_5'><%= number_with_precision(order.sale_price, :precision => 2) %></dd>
            <dt class='grid_3 alpha'>预交订金:</dt>
            <dd class='grid_5'><%= number_with_precision(order.order_price, :precision => 2) %></dd>
          </dl>
          <dl class='grid_17 alpha'>          
            <dt class='grid_3 alpha'>已收尾款:</dt>
            <dd class='grid_5'><%= number_with_precision(order.gathered_balance, :precision => 2) %></dd>           
            <dt class='grid_3 alpha'>待收尾款:</dt>
            <dd class='grid_5'><%= number_with_precision(order.balance, :precision => 2) %></dd>
          </dl>
          <dl class='grid_17 alpha'>
            <dt class='grid_3 alpha'>订做成本:</dt>
            <dd class='grid_5'><%= number_with_precision(order.how_much, :precision => 2) %></dd>
            <dt class='grid_3 alpha'>售后成本:</dt>
            <dd class='grid_5'><%= number_with_precision(order.after_serviced_cost, :precision => 2) %></dd>
          </dl>
        </div>
        <div class="grid_17 alpha omega items">
          <div id="items" class='spacing'>
            <!--这里是预订项信息-->
            <%= render :partial => 'orders/order_items/table_in_index.html', :locals => { :can_edit => false, :order => order} %>
          </div>
        </div>
        <%if order.remark.present?%>
        <div class='grid_17 alpha remark'>
          <dl class='grid_17 alpha '>
            <dt class='grid_3 alpha'>异常说明：</dt>
            <dd class='grid_12 omega '><%= order.remark%></dd>
          </dl>
        </div>
        <% end %>
      </div>
    <% end %>
    <% if orders.empty? %>
    <div class='grid_17 alpha no_orders' >
      无记录
    </div>
    <% end %>
  </div>
  <div class='grid_17 page b_page'>
    共<b><%= orders.size %></b>张
  </div>
</div>
<%= yield  %>